# -*- coding: utf-8 -*-

import os

# 定义爬虫启动方法
from twisted.internet import reactor
from scrapy.utils.project import get_project_settings
def run_spider(spider_name):
    '''会启用pipeline'''
    from scrapy.crawler import CrawlerProcess
    process = CrawlerProcess(get_project_settings())
    process.crawl('booktxt') # scrapy项目中spider的name值
    process.start()

if __name__ == '__main__':
    run_spider('booktxt')